Skip to content

Settings

In production you usually want consistent behavior, shared defaults, and controllable logs. Agently settings are hierarchical: global → Agent → Request/Session. Use set_settings with dot-path keys.

1. How to configure

Global and local overrides:

python
from agently import Agently

Agently.set_settings("runtime.show_model_logs", True)

agent = Agently.create_agent()
agent.set_settings("prompt.add_current_time", False)

OpenAICompatible path alias:

python
Agently.set_settings("OpenAICompatible", {
  "base_url": "https://api.openai.com/v1",
  "api_key": "YOUR_API_KEY",
  "model": "gpt-4o-mini"
})

Environment placeholder substitution (load from .env/environment):

python
Agently.set_settings(
  "OpenAICompatible",
  { "api_key": "${ENV.OPENAI_API_KEY}" },
  auto_load_env=True,
)

2. Core settings

2.1 Storage (Not available now)

KeyDefaultDescription
storage.db_urlsqlite+aiosqlite:///localstorage.dbLocal storage database URL.

2.2 Prompt

KeyDefaultDescription
prompt.add_current_timetrueInjects current time into the info section.
prompt.role_mappingSee belowRole mapping for prompt → message conversion.
prompt.prompt_title_mappingSee belowSection title mapping for prompt assembly.

Default prompt.role_mapping:

yaml
system: system
developer: developer
assistant: assistant
user: user
_: assistant

Default prompt.prompt_title_mapping:

yaml
system: SYSTEM
developer: DEVELOPER DIRECTIONS
chat_history: CHAT HISTORY
info: INFO
tools: TOOLS
action_results: ACTION RESULTS
instruct: INSTRUCT
examples: EXAMPLES
input: INPUT
output: OUTPUT
output_requirement: OUTPUT REQUIREMENT

2.3 Response

KeyDefaultDescription
response.streaming_parsefalseGlobal switch for structured streaming parsing.
response.streaming_parse_path_styledotPath style for streaming output: dot or slash.

3. Runtime and logs

KeyDefaultDescription
runtime.raise_errortrueRaise normal errors (otherwise log only).
runtime.raise_criticaltrueRaise critical errors (otherwise log only).
runtime.show_model_logsfalseShow model request/response logs.
runtime.show_tool_logsfalseShow tool invocation logs.
runtime.show_trigger_flow_logsfalseShow TriggerFlow execution logs.
runtime.httpx_log_levelWARNINGhttpx/httpcore log level.

Debug shortcut:

KeyValueDescription
debugtrue/falseToggles show_*_logs and updates httpx_log_level.

4. Plugin activation

Use plugins.<Type>.activate to choose the active implementation:

Plugin typeDefault
plugins.PromptGenerator.activateAgentlyPromptGenerator
plugins.ModelRequester.activateOpenAICompatible
plugins.ResponseParser.activateAgentlyResponseParser
plugins.ToolManager.activateAgentlyToolManager
plugins.Session.activateAgentlyMemoSession

5. OpenAICompatible settings

Namespace: plugins.ModelRequester.OpenAICompatible (alias: OpenAICompatible).

5.1 Model and endpoints

KeyDefaultDescription
model_typechatRequest type: chat/completions/embeddings.
modelnullExplicit model name; falls back to default_model.
default_model.chatgpt-4.1Default chat model.
default_model.completionsgpt-3.5-turbo-instructDefault completions model.
default_model.embeddingstext-embedding-ada-002Default embeddings model.
base_urlhttps://api.openai.com/v1API base URL.
full_urlnullFull request URL (overrides base_url + path_mapping).
path_mapping.chat/chat/completionsChat endpoint path.
path_mapping.completions/completionsCompletions endpoint path.
path_mapping.embeddings/embeddingsEmbeddings endpoint path.

5.2 Auth and network

KeyDefaultDescription
api_keynullAPI key shortcut.
authnullCustom auth structure (api_key/headers/body).
headers{}Extra request headers.
proxynullProxy address (passed to httpx).
timeoutSee belowhttpx.Timeout config.
client_options{}Extra args for httpx.AsyncClient.

Default timeout:

yaml
connect: 30.0
read: 600.0
write: 30.0
pool: 30.0

5.3 Request options

KeyDefaultDescription
request_options{}Request body options (e.g. temperature), merged with prompt options.
streamtrueUse streaming (embeddings force false).

5.4 Response mapping

KeyDefaultDescription
content_mappingSee belowMap provider fields to unified events and values.
content_mapping_styledotField path style: dot/slash.
yield_extra_content_separatelytrueEmit extra fields as separate events.
strict_role_orderstrueEnforce role ordering when building messages.
rich_contentfalseEnable rich content (attachments).

Default content_mapping:

yaml
id: id
role: choices[0].delta.role
reasoning: choices[0].delta.reasoning_content
delta: choices[0].delta.content
tool_calls: choices[0].delta.tool_calls
done: null
usage: usage
finish_reason: choices[0].finish_reason
extra_delta:
  function_call: choices[0].delta.function_call
extra_done: null

6. Session and memo (Beta)

KeyDefaultDescription
session.memo.enabledfalseEnable memo updates.
session.memo.instructSee belowPrompt instructions for memo updates.
session.resize.every_n_turns8Turn interval for resize decisions.
session.resize.max_messages_text_length12000Max character budget for current context.
session.resize.max_keep_messages_countnullKeep last N messages (null means unlimited).

Default session.memo.instruct:

yaml
- Update the memo dictionary based on the provided messages.
- Keep stable preferences, constraints, and facts that help future turns.
- Add new keys or update existing ones as needed.
- Return the updated memo dictionary.

Legacy keys:

Legacy keyEquivalent
session.resize.max_current_charssession.resize.max_messages_text_length
session.resize.keep_last_messagessession.resize.max_keep_messages_count

7. ChatSession recording (Deprecated)

KeyDefaultDescription
record_input_paths[]Input path list in (slot, path) format (empty means full input).
record_input_modeallInput record mode: all/first.
record_output_paths[]Output paths to record (empty means full output).
record_output_modeallOutput record mode: all/first.

Paths use dot (e.g. a.b.c) or slash (e.g. a/b/c) style.