Skip to content

Settings

Applies to: 4.0.8.1+

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

5. OpenAICompatible settings

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

For parameter precedence, tools behavior, and practical temperature setup: /en/openai-api-format

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 (v4.0.8.1+)

Session was redesigned in v4.0.8.1. Default Agent now uses SessionExtension for context injection and request recording.

KeyDefaultDescription
session.max_lengthnullMax window length. When set to an integer, built-in simple_cut trims context_window.
session.input_keysnullSelector paths for recorded input fields in finally hook. null records full request text.
session.reply_keysnullSelector paths for recorded output fields in finally hook. null records full output.

Notes:

  • selectors support both dot and slash path styles
  • input selectors support .request.* and .agent.* prefixes
  • memo updates no longer depend on legacy session.memo.* configs; implement via Session.register_*_handler()

7. Compatibility and deprecations

ItemStatusNotes
set_debug_console(\"ON\")DeprecatedOnly emits warning; no runtime behavior change.
ChatSessionExtensionDeprecatedUse default SessionExtension instead.

If your code still follows legacy helper style, migrate to activate_session / deactivate_session + session.max_length + custom strategies.