mantisdk 0.1.2__tar.gz → 0.1.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {mantisdk-0.1.2 → mantisdk-0.1.3}/PKG-INFO +1 -2
- {mantisdk-0.1.2 → mantisdk-0.1.3}/pyproject.toml +1 -5
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/__init__.py +1 -1
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/tracing/__init__.py +21 -12
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/tracing/api.py +259 -58
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/tracing/init.py +2 -29
- mantisdk-0.1.3/src/mantisdk/tracing/semconv.py +82 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/.gitignore +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/LICENSE +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/PUBLISHING.md +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/README.md +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/adapter/__init__.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/adapter/base.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/adapter/messages.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/adapter/triplet.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/__init__.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/apo/__init__.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/apo/apo.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/apo/prompts/apply_edit_variant01.poml +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/apo/prompts/apply_edit_variant02.poml +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/apo/prompts/text_gradient_variant01.poml +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/apo/prompts/text_gradient_variant02.poml +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/apo/prompts/text_gradient_variant03.poml +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/base.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/decorator.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/fast.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/gepa/__init__.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/gepa/adapter.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/gepa/gepa.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/gepa/lib/__init__.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/gepa/lib/adapters/README.md +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/gepa/lib/adapters/__init__.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/gepa/lib/adapters/anymaths_adapter/README.md +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/gepa/lib/adapters/anymaths_adapter/__init__.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/gepa/lib/adapters/anymaths_adapter/anymaths_adapter.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/gepa/lib/adapters/anymaths_adapter/requirements.txt +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/gepa/lib/adapters/default_adapter/README.md +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/gepa/lib/adapters/default_adapter/__init__.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/gepa/lib/adapters/default_adapter/default_adapter.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/gepa/lib/adapters/dspy_adapter/README.md +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/gepa/lib/adapters/dspy_adapter/__init__.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/gepa/lib/adapters/dspy_adapter/dspy_adapter.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/gepa/lib/adapters/dspy_full_program_adapter/README.md +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/gepa/lib/adapters/dspy_full_program_adapter/dspy_program_proposal_signature.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/gepa/lib/adapters/dspy_full_program_adapter/full_program_adapter.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/gepa/lib/adapters/generic_rag_adapter/GEPA_RAG.md +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/gepa/lib/adapters/generic_rag_adapter/__init__.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/gepa/lib/adapters/generic_rag_adapter/evaluation_metrics.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/gepa/lib/adapters/generic_rag_adapter/generic_rag_adapter.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/gepa/lib/adapters/generic_rag_adapter/rag_pipeline.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/gepa/lib/adapters/generic_rag_adapter/vector_store_interface.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/gepa/lib/adapters/generic_rag_adapter/vector_stores/__init__.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/gepa/lib/adapters/generic_rag_adapter/vector_stores/chroma_store.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/gepa/lib/adapters/generic_rag_adapter/vector_stores/lancedb_store.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/gepa/lib/adapters/generic_rag_adapter/vector_stores/milvus_store.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/gepa/lib/adapters/generic_rag_adapter/vector_stores/qdrant_store.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/gepa/lib/adapters/generic_rag_adapter/vector_stores/weaviate_store.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/gepa/lib/adapters/mcp_adapter/README.md +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/gepa/lib/adapters/mcp_adapter/__init__.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/gepa/lib/adapters/mcp_adapter/mcp_adapter.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/gepa/lib/adapters/mcp_adapter/mcp_client.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/gepa/lib/adapters/terminal_bench_adapter/README.md +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/gepa/lib/adapters/terminal_bench_adapter/__init__.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/gepa/lib/adapters/terminal_bench_adapter/terminal_bench_adapter.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/gepa/lib/api.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/gepa/lib/core/__init__.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/gepa/lib/core/adapter.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/gepa/lib/core/data_loader.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/gepa/lib/core/engine.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/gepa/lib/core/result.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/gepa/lib/core/state.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/gepa/lib/examples/__init__.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/gepa/lib/examples/aime.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/gepa/lib/examples/anymaths-bench/eval_default.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/gepa/lib/examples/anymaths-bench/prompt-templates/instruction_prompt.txt +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/gepa/lib/examples/anymaths-bench/prompt-templates/optimal_prompt.txt +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/gepa/lib/examples/anymaths-bench/train_anymaths.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/gepa/lib/examples/dspy_full_program_evolution/arc_agi.ipynb +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/gepa/lib/examples/dspy_full_program_evolution/example.ipynb +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/gepa/lib/examples/mcp_adapter/__init__.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/gepa/lib/examples/mcp_adapter/mcp_optimization_example.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/gepa/lib/examples/rag_adapter/RAG_GUIDE.md +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/gepa/lib/examples/rag_adapter/__init__.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/gepa/lib/examples/rag_adapter/rag_optimization.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/gepa/lib/examples/rag_adapter/requirements-rag.txt +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/gepa/lib/examples/terminal-bench/prompt-templates/instruction_prompt.txt +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/gepa/lib/examples/terminal-bench/prompt-templates/terminus.txt +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/gepa/lib/examples/terminal-bench/train_terminus.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/gepa/lib/gepa_utils.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/gepa/lib/logging/__init__.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/gepa/lib/logging/experiment_tracker.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/gepa/lib/logging/logger.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/gepa/lib/logging/utils.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/gepa/lib/proposer/__init__.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/gepa/lib/proposer/base.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/gepa/lib/proposer/merge.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/gepa/lib/proposer/reflective_mutation/__init__.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/gepa/lib/proposer/reflective_mutation/base.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/gepa/lib/proposer/reflective_mutation/reflective_mutation.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/gepa/lib/py.typed +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/gepa/lib/strategies/__init__.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/gepa/lib/strategies/batch_sampler.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/gepa/lib/strategies/candidate_selector.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/gepa/lib/strategies/component_selector.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/gepa/lib/strategies/eval_policy.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/gepa/lib/strategies/instruction_proposal.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/gepa/lib/utils/__init__.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/gepa/lib/utils/stop_condition.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/gepa/tracing.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/utils.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/verl/__init__.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/algorithm/verl/interface.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/cli/__init__.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/cli/prometheus.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/cli/store.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/cli/vllm.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/client.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/config.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/emitter/__init__.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/emitter/annotation.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/emitter/exception.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/emitter/message.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/emitter/object.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/emitter/reward.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/env_var.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/execution/__init__.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/execution/base.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/execution/client_server.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/execution/events.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/execution/inter_process.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/execution/shared_memory.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/instrumentation/__init__.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/instrumentation/agentops.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/instrumentation/agentops_langchain.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/instrumentation/litellm.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/instrumentation/vllm.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/instrumentation/weave.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/litagent/__init__.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/litagent/decorator.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/litagent/litagent.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/llm_proxy.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/logging.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/reward.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/runner/__init__.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/runner/agent.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/runner/base.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/runner/legacy.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/semconv.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/server.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/store/__init__.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/store/base.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/store/client_server.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/store/collection/__init__.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/store/collection/base.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/store/collection/memory.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/store/collection/mongo.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/store/collection_based.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/store/insight.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/store/listener.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/store/memory.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/store/mongo.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/store/sqlite.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/store/threading.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/store/utils.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/tracer/__init__.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/tracer/agentops.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/tracer/base.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/tracer/dummy.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/tracer/otel.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/tracer/weave.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/tracing/attributes.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/tracing/exporters/__init__.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/tracing/exporters/insight.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/tracing/instrumentors/__init__.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/tracing/instrumentors/claude_agent_sdk.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/tracing/instrumentors/instrumentation_principles.md +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/tracing/instrumentors/registry.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/trainer/__init__.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/trainer/init_utils.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/trainer/legacy.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/trainer/registry.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/trainer/trainer.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/types/__init__.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/types/core.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/types/resources.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/types/tracer.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/types/tracing.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/utils/__init__.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/utils/id.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/utils/metrics.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/utils/otel.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/utils/otlp.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/utils/server_launcher.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/utils/system_snapshot.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/verl/__init__.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/verl/__main__.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/verl/async_server.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/verl/config.yaml +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/verl/daemon.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/verl/dataset.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/verl/entrypoint.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/src/mantisdk/verl/trainer.py +0 -0
- {mantisdk-0.1.2 → mantisdk-0.1.3}/uv.lock +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: mantisdk
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.3
|
|
4
4
|
Summary: Mantisdk - AI Agent Training and Evaluation Platform
|
|
5
5
|
Project-URL: Homepage, https://github.com/withmetis/mantis
|
|
6
6
|
Project-URL: Documentation, https://withmetis.github.io/mantis/mantisdk/
|
|
@@ -19,7 +19,6 @@ Classifier: Programming Language :: Python :: 3.11
|
|
|
19
19
|
Classifier: Programming Language :: Python :: 3.12
|
|
20
20
|
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
21
21
|
Requires-Python: >=3.10
|
|
22
|
-
Requires-Dist: agentops>=0.4.13
|
|
23
22
|
Requires-Dist: aiohttp
|
|
24
23
|
Requires-Dist: aiologic
|
|
25
24
|
Requires-Dist: fastapi
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "mantisdk"
|
|
3
|
-
version = "0.1.
|
|
3
|
+
version = "0.1.3"
|
|
4
4
|
description = "Mantisdk - AI Agent Training and Evaluation Platform"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.10"
|
|
@@ -28,7 +28,6 @@ dependencies = [
|
|
|
28
28
|
"gpustat",
|
|
29
29
|
"setproctitle",
|
|
30
30
|
"flask",
|
|
31
|
-
"agentops>=0.4.13",
|
|
32
31
|
"uvicorn",
|
|
33
32
|
"fastapi",
|
|
34
33
|
"aiohttp",
|
|
@@ -100,11 +99,9 @@ experiment = [
|
|
|
100
99
|
]
|
|
101
100
|
|
|
102
101
|
core-legacy = [
|
|
103
|
-
"agentops<=0.4.18",
|
|
104
102
|
"openai<2.0.0",
|
|
105
103
|
]
|
|
106
104
|
core-stable = [
|
|
107
|
-
"agentops>=0.4.21",
|
|
108
105
|
"openai>=2.0.0",
|
|
109
106
|
]
|
|
110
107
|
|
|
@@ -334,7 +331,6 @@ testpaths = ["tests"]
|
|
|
334
331
|
markers = [
|
|
335
332
|
"openai: tests that require OpenAI API",
|
|
336
333
|
"gpu: tests that require GPU",
|
|
337
|
-
"agentops: tests that require AgentOps",
|
|
338
334
|
"weave: tests that require Weave",
|
|
339
335
|
"llmproxy: tests that require LiteLLM",
|
|
340
336
|
"mongo: tests that require MongoDB",
|
|
@@ -3,25 +3,29 @@
|
|
|
3
3
|
"""Standalone tracing module for MantisDK.
|
|
4
4
|
|
|
5
5
|
This module provides a "one-liner" entry point for instrumenting applications
|
|
6
|
-
with OpenTelemetry, compatible with OpenInference
|
|
6
|
+
with OpenTelemetry, compatible with OpenInference ecosystem,
|
|
7
7
|
while natively supporting export to Mantis Insight.
|
|
8
8
|
|
|
9
9
|
Example usage::
|
|
10
10
|
|
|
11
|
-
import mantisdk.
|
|
11
|
+
import mantisdk.tracing as tracing
|
|
12
12
|
|
|
13
13
|
# Auto-detect Insight from environment variables
|
|
14
14
|
tracing.init()
|
|
15
15
|
|
|
16
|
-
# Use
|
|
17
|
-
with tracing.trace("my-workflow"):
|
|
18
|
-
with tracing.span("step-1"):
|
|
19
|
-
do_work()
|
|
20
|
-
|
|
21
|
-
# Use decorators
|
|
16
|
+
# Use as a decorator (auto-captures input/output)
|
|
22
17
|
@tracing.trace
|
|
23
|
-
def my_function():
|
|
24
|
-
|
|
18
|
+
def my_function(query: str) -> dict:
|
|
19
|
+
return {"result": query.upper()}
|
|
20
|
+
|
|
21
|
+
# Use as a context manager (explicit input/output)
|
|
22
|
+
with tracing.trace("my-workflow", input=query) as span:
|
|
23
|
+
result = do_work()
|
|
24
|
+
span.set_attribute(tracing.semconv.TRACE_OUTPUT, result)
|
|
25
|
+
|
|
26
|
+
# Use semantic conventions for rich metadata
|
|
27
|
+
span.set_attribute(tracing.semconv.USER_ID, "user-123")
|
|
28
|
+
span.set_attribute(tracing.semconv.SESSION_ID, "session-456")
|
|
25
29
|
|
|
26
30
|
# Ensure spans are flushed on shutdown
|
|
27
31
|
tracing.shutdown()
|
|
@@ -34,7 +38,8 @@ Environment variables for Insight auto-detect:
|
|
|
34
38
|
"""
|
|
35
39
|
|
|
36
40
|
from .init import init, instrument, shutdown, flush
|
|
37
|
-
from .api import trace, span, tool, atrace, aspan
|
|
41
|
+
from .api import trace, span, tool, atrace, aspan, get_current_span
|
|
42
|
+
from . import semconv
|
|
38
43
|
|
|
39
44
|
# Re-export exporter factory for explicit configuration
|
|
40
45
|
from .exporters.insight import insight as insight_exporter
|
|
@@ -45,13 +50,17 @@ __all__ = [
|
|
|
45
50
|
"instrument",
|
|
46
51
|
"shutdown",
|
|
47
52
|
"flush",
|
|
48
|
-
# Context managers (sync)
|
|
53
|
+
# Context managers / decorators (sync)
|
|
49
54
|
"trace",
|
|
50
55
|
"span",
|
|
51
56
|
"tool",
|
|
52
57
|
# Context managers (async)
|
|
53
58
|
"atrace",
|
|
54
59
|
"aspan",
|
|
60
|
+
# Span utilities
|
|
61
|
+
"get_current_span",
|
|
62
|
+
# Semantic conventions
|
|
63
|
+
"semconv",
|
|
55
64
|
# Exporter factory
|
|
56
65
|
"insight_exporter",
|
|
57
66
|
]
|
|
@@ -14,12 +14,16 @@ from __future__ import annotations
|
|
|
14
14
|
|
|
15
15
|
import asyncio
|
|
16
16
|
import functools
|
|
17
|
+
import inspect
|
|
18
|
+
import json
|
|
17
19
|
import logging
|
|
18
20
|
from contextlib import asynccontextmanager, contextmanager
|
|
19
21
|
from typing import Any, AsyncGenerator, Callable, Generator, Optional, TypeVar, Union
|
|
20
22
|
|
|
21
|
-
from opentelemetry import trace
|
|
22
|
-
from opentelemetry.trace import Span, SpanKind, Status, StatusCode
|
|
23
|
+
from opentelemetry import trace as otel_trace
|
|
24
|
+
from opentelemetry.trace import Span, SpanKind, Status, StatusCode, Tracer
|
|
25
|
+
|
|
26
|
+
from . import semconv
|
|
23
27
|
|
|
24
28
|
logger = logging.getLogger(__name__)
|
|
25
29
|
|
|
@@ -30,69 +34,246 @@ F = TypeVar("F", bound=Callable[..., Any])
|
|
|
30
34
|
TRACER_NAME = "mantisdk.tracing"
|
|
31
35
|
|
|
32
36
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
37
|
+
# =============================================================================
|
|
38
|
+
# Serialization helpers for I/O capture
|
|
39
|
+
# =============================================================================
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def _safe_serialize(value: Any) -> Any:
|
|
43
|
+
"""Recursively serialize a value to JSON-compatible format."""
|
|
44
|
+
if value is None or isinstance(value, (bool, int, float, str)):
|
|
45
|
+
return value
|
|
46
|
+
if isinstance(value, (list, tuple)):
|
|
47
|
+
return [_safe_serialize(v) for v in value]
|
|
48
|
+
if isinstance(value, dict):
|
|
49
|
+
return {str(k): _safe_serialize(v) for k, v in value.items()}
|
|
50
|
+
# Fallback for complex objects (Pydantic models, dataclasses, etc.)
|
|
51
|
+
if hasattr(value, "model_dump"):
|
|
52
|
+
return _safe_serialize(value.model_dump())
|
|
53
|
+
if hasattr(value, "__dict__"):
|
|
54
|
+
return _safe_serialize(vars(value))
|
|
55
|
+
return str(value)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def _serialize_value(value: Any) -> str:
|
|
59
|
+
"""Safely serialize a value to a JSON string for span attributes."""
|
|
60
|
+
if value is None:
|
|
61
|
+
return "null"
|
|
62
|
+
if isinstance(value, str):
|
|
63
|
+
return value
|
|
64
|
+
if isinstance(value, (bool, int, float)):
|
|
65
|
+
return json.dumps(value)
|
|
66
|
+
try:
|
|
67
|
+
return json.dumps(_safe_serialize(value))
|
|
68
|
+
except Exception:
|
|
69
|
+
return str(value)
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
def _capture_function_input(fn: Callable[..., Any], args: tuple[Any, ...], kwargs: dict[str, Any]) -> str:
|
|
73
|
+
"""Capture function arguments as a JSON string."""
|
|
74
|
+
try:
|
|
75
|
+
sig = inspect.signature(fn)
|
|
76
|
+
bound = sig.bind(*args, **kwargs)
|
|
77
|
+
bound.apply_defaults()
|
|
78
|
+
|
|
79
|
+
# Filter out 'self' and 'cls' parameters
|
|
80
|
+
input_dict = {
|
|
81
|
+
k: _safe_serialize(v)
|
|
82
|
+
for k, v in bound.arguments.items()
|
|
83
|
+
if k not in ("self", "cls")
|
|
84
|
+
}
|
|
36
85
|
|
|
86
|
+
return json.dumps(input_dict) if input_dict else "{}"
|
|
87
|
+
except Exception:
|
|
88
|
+
# Fallback: simple representation
|
|
89
|
+
return json.dumps({
|
|
90
|
+
"args": [str(a) for a in args],
|
|
91
|
+
"kwargs": {k: str(v) for k, v in kwargs.items()}
|
|
92
|
+
})
|
|
37
93
|
|
|
38
|
-
@contextmanager
|
|
39
|
-
def trace(
|
|
40
|
-
name: str,
|
|
41
|
-
*,
|
|
42
|
-
kind: SpanKind = SpanKind.INTERNAL,
|
|
43
|
-
attributes: Optional[dict[str, Any]] = None,
|
|
44
|
-
record_exception: bool = True,
|
|
45
|
-
set_status_on_exception: bool = True,
|
|
46
|
-
**extra_attributes: Any,
|
|
47
|
-
) -> Generator[Span, None, None]:
|
|
48
|
-
"""Context manager to create a trace (root span).
|
|
49
94
|
|
|
50
|
-
|
|
51
|
-
|
|
95
|
+
def _get_tracer() -> Tracer:
|
|
96
|
+
"""Get the MantisDK tracer instance."""
|
|
97
|
+
return otel_trace.get_tracer(TRACER_NAME)
|
|
52
98
|
|
|
53
|
-
Args:
|
|
54
|
-
name: The name of the trace/span.
|
|
55
|
-
kind: The span kind (default: INTERNAL).
|
|
56
|
-
attributes: Dictionary of attributes to set on the span.
|
|
57
|
-
record_exception: If True, exceptions are recorded on the span.
|
|
58
|
-
set_status_on_exception: If True, span status is set to ERROR on exception.
|
|
59
|
-
**extra_attributes: Additional attributes as keyword arguments.
|
|
60
99
|
|
|
61
|
-
|
|
62
|
-
|
|
100
|
+
class trace:
|
|
101
|
+
"""Create a trace span - works as both a decorator and context manager.
|
|
63
102
|
|
|
64
|
-
|
|
103
|
+
As a decorator, automatically captures function inputs and outputs::
|
|
65
104
|
|
|
66
|
-
|
|
105
|
+
@tracing.trace
|
|
106
|
+
def my_function(query: str) -> dict:
|
|
107
|
+
return {"result": query.upper()}
|
|
108
|
+
|
|
109
|
+
@tracing.trace(name="custom-name", capture_output=False)
|
|
110
|
+
def another_function(data):
|
|
111
|
+
process(data)
|
|
67
112
|
|
|
68
|
-
|
|
113
|
+
As a context manager, allows explicit input/output control::
|
|
69
114
|
|
|
70
|
-
with tracing.trace("my-workflow",
|
|
71
|
-
span.set_attribute("step", "preprocessing")
|
|
115
|
+
with tracing.trace("my-workflow", input=query) as span:
|
|
72
116
|
result = do_work()
|
|
73
|
-
span.set_attribute(
|
|
117
|
+
span.set_attribute(tracing.semconv.TRACE_OUTPUT, result)
|
|
118
|
+
|
|
119
|
+
Args:
|
|
120
|
+
name_or_func: Either the span name (str) or the function to decorate.
|
|
121
|
+
name: Explicit span name (for decorator with custom name).
|
|
122
|
+
input: Input value to capture (context manager mode).
|
|
123
|
+
kind: The span kind (default: INTERNAL).
|
|
124
|
+
attributes: Dictionary of attributes to set on the span.
|
|
125
|
+
capture_input: Auto-capture function input (decorator mode, default: True).
|
|
126
|
+
capture_output: Auto-capture function output (decorator mode, default: True).
|
|
127
|
+
record_exception: If True, exceptions are recorded on the span.
|
|
128
|
+
set_status_on_exception: If True, span status is set to ERROR on exception.
|
|
74
129
|
"""
|
|
75
|
-
tracer = _get_tracer()
|
|
76
|
-
all_attributes = {**(attributes or {}), **extra_attributes}
|
|
77
130
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
131
|
+
def __init__(
|
|
132
|
+
self,
|
|
133
|
+
name_or_func: Optional[Union[str, Callable[..., Any]]] = None,
|
|
134
|
+
*,
|
|
135
|
+
name: Optional[str] = None,
|
|
136
|
+
input: Optional[Any] = None,
|
|
137
|
+
kind: SpanKind = SpanKind.INTERNAL,
|
|
138
|
+
attributes: Optional[dict[str, Any]] = None,
|
|
139
|
+
capture_input: bool = True,
|
|
140
|
+
capture_output: bool = True,
|
|
141
|
+
record_exception: bool = True,
|
|
142
|
+
set_status_on_exception: bool = True,
|
|
143
|
+
):
|
|
144
|
+
self._name_or_func = name_or_func
|
|
145
|
+
self._explicit_name = name
|
|
146
|
+
self._input = input
|
|
147
|
+
self._kind = kind
|
|
148
|
+
self._attributes = attributes
|
|
149
|
+
self._capture_input = capture_input
|
|
150
|
+
self._capture_output = capture_output
|
|
151
|
+
self._record_exception = record_exception
|
|
152
|
+
self._set_status_on_exception = set_status_on_exception
|
|
153
|
+
self._span: Optional[Span] = None
|
|
154
|
+
self._token: Optional[Any] = None
|
|
155
|
+
|
|
156
|
+
# If called as @trace without parentheses, name_or_func is the function
|
|
157
|
+
if callable(name_or_func):
|
|
158
|
+
self._func = name_or_func
|
|
159
|
+
self._span_name = name or name_or_func.__name__
|
|
160
|
+
else:
|
|
161
|
+
self._func = None
|
|
162
|
+
self._span_name = name_or_func or name or "trace"
|
|
163
|
+
|
|
164
|
+
def __call__(self, *args: Any, **kwargs: Any) -> Any:
|
|
165
|
+
"""Handle decorator invocation."""
|
|
166
|
+
# If we already have a function, this is the actual call
|
|
167
|
+
if self._func is not None:
|
|
168
|
+
return self._invoke_decorated(self._func, args, kwargs)
|
|
169
|
+
|
|
170
|
+
# If first arg is a callable, we're being used as @trace(...) decorator
|
|
171
|
+
if args and callable(args[0]) and not kwargs:
|
|
172
|
+
func = args[0]
|
|
173
|
+
self._func = func
|
|
174
|
+
self._span_name = self._explicit_name or func.__name__
|
|
175
|
+
|
|
176
|
+
# Return a wrapper that will be called when the function is invoked
|
|
177
|
+
if asyncio.iscoroutinefunction(func):
|
|
178
|
+
@functools.wraps(func)
|
|
179
|
+
async def async_wrapper(*a: Any, **kw: Any) -> Any:
|
|
180
|
+
return await self._invoke_decorated_async(func, a, kw)
|
|
181
|
+
return async_wrapper
|
|
182
|
+
else:
|
|
183
|
+
@functools.wraps(func)
|
|
184
|
+
def sync_wrapper(*a: Any, **kw: Any) -> Any:
|
|
185
|
+
return self._invoke_decorated(func, a, kw)
|
|
186
|
+
return sync_wrapper
|
|
187
|
+
|
|
188
|
+
raise TypeError("trace() requires a name string or a function")
|
|
189
|
+
|
|
190
|
+
def _invoke_decorated(self, func: Callable[..., Any], args: tuple[Any, ...], kwargs: dict[str, Any]) -> Any:
|
|
191
|
+
"""Invoke a decorated sync function with tracing."""
|
|
192
|
+
tracer = _get_tracer()
|
|
193
|
+
|
|
194
|
+
with tracer.start_as_current_span(
|
|
195
|
+
name=self._span_name,
|
|
196
|
+
kind=self._kind,
|
|
197
|
+
attributes=self._attributes,
|
|
198
|
+
record_exception=self._record_exception,
|
|
199
|
+
set_status_on_exception=self._set_status_on_exception,
|
|
200
|
+
) as span:
|
|
201
|
+
# Capture input
|
|
202
|
+
if self._capture_input:
|
|
203
|
+
input_val = _capture_function_input(func, args, kwargs)
|
|
204
|
+
span.set_attribute(semconv.OBSERVATION_INPUT, input_val)
|
|
205
|
+
|
|
206
|
+
result = func(*args, **kwargs)
|
|
207
|
+
|
|
208
|
+
# Capture output
|
|
209
|
+
if self._capture_output:
|
|
210
|
+
span.set_attribute(semconv.OBSERVATION_OUTPUT, _serialize_value(result))
|
|
211
|
+
|
|
212
|
+
return result
|
|
213
|
+
|
|
214
|
+
async def _invoke_decorated_async(self, func: Callable[..., Any], args: tuple[Any, ...], kwargs: dict[str, Any]) -> Any:
|
|
215
|
+
"""Invoke a decorated async function with tracing."""
|
|
216
|
+
tracer = _get_tracer()
|
|
217
|
+
|
|
218
|
+
with tracer.start_as_current_span(
|
|
219
|
+
name=self._span_name,
|
|
220
|
+
kind=self._kind,
|
|
221
|
+
attributes=self._attributes,
|
|
222
|
+
record_exception=self._record_exception,
|
|
223
|
+
set_status_on_exception=self._set_status_on_exception,
|
|
224
|
+
) as span:
|
|
225
|
+
# Capture input
|
|
226
|
+
if self._capture_input:
|
|
227
|
+
input_val = _capture_function_input(func, args, kwargs)
|
|
228
|
+
span.set_attribute(semconv.OBSERVATION_INPUT, input_val)
|
|
229
|
+
|
|
230
|
+
result = await func(*args, **kwargs)
|
|
231
|
+
|
|
232
|
+
# Capture output
|
|
233
|
+
if self._capture_output:
|
|
234
|
+
span.set_attribute(semconv.OBSERVATION_OUTPUT, _serialize_value(result))
|
|
235
|
+
|
|
236
|
+
return result
|
|
237
|
+
|
|
238
|
+
def __enter__(self) -> Span:
|
|
239
|
+
"""Context manager entry - start the span."""
|
|
240
|
+
tracer = _get_tracer()
|
|
241
|
+
self._span = tracer.start_span(
|
|
242
|
+
name=self._span_name,
|
|
243
|
+
kind=self._kind,
|
|
244
|
+
attributes=self._attributes,
|
|
245
|
+
record_exception=self._record_exception,
|
|
246
|
+
set_status_on_exception=self._set_status_on_exception,
|
|
247
|
+
)
|
|
248
|
+
# Store the context manager to properly exit later
|
|
249
|
+
self._use_span_cm = otel_trace.use_span(self._span, end_on_exit=False)
|
|
250
|
+
self._use_span_cm.__enter__()
|
|
251
|
+
|
|
252
|
+
# Set input if provided
|
|
253
|
+
if self._input is not None:
|
|
254
|
+
self._span.set_attribute(semconv.TRACE_INPUT, _serialize_value(self._input))
|
|
255
|
+
|
|
256
|
+
return self._span
|
|
257
|
+
|
|
258
|
+
def __exit__(self, exc_type: Any, exc_val: Any, exc_tb: Any) -> None:
|
|
259
|
+
"""Context manager exit - end the span."""
|
|
85
260
|
try:
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
261
|
+
if self._span is not None:
|
|
262
|
+
if exc_val is not None and self._record_exception:
|
|
263
|
+
self._span.record_exception(exc_val)
|
|
264
|
+
if exc_val is not None and self._set_status_on_exception:
|
|
265
|
+
self._span.set_status(Status(StatusCode.ERROR, str(exc_val)))
|
|
266
|
+
self._span.end()
|
|
267
|
+
finally:
|
|
268
|
+
if hasattr(self, '_use_span_cm') and self._use_span_cm is not None:
|
|
269
|
+
self._use_span_cm.__exit__(exc_type, exc_val, exc_tb)
|
|
90
270
|
|
|
91
271
|
|
|
92
272
|
@contextmanager
|
|
93
273
|
def span(
|
|
94
274
|
name: str,
|
|
95
275
|
*,
|
|
276
|
+
input: Optional[Any] = None,
|
|
96
277
|
kind: SpanKind = SpanKind.INTERNAL,
|
|
97
278
|
attributes: Optional[dict[str, Any]] = None,
|
|
98
279
|
record_exception: bool = True,
|
|
@@ -106,6 +287,7 @@ def span(
|
|
|
106
287
|
|
|
107
288
|
Args:
|
|
108
289
|
name: The name of the span.
|
|
290
|
+
input: Input value to capture (displayed in Insight UI).
|
|
109
291
|
kind: The span kind (default: INTERNAL).
|
|
110
292
|
attributes: Dictionary of attributes to set on the span.
|
|
111
293
|
record_exception: If True, exceptions are recorded on the span.
|
|
@@ -117,12 +299,12 @@ def span(
|
|
|
117
299
|
|
|
118
300
|
Example::
|
|
119
301
|
|
|
120
|
-
import mantisdk.
|
|
302
|
+
import mantisdk.tracing as tracing
|
|
121
303
|
|
|
122
304
|
with tracing.trace("my-workflow"):
|
|
123
|
-
with tracing.span("step.load_data",
|
|
305
|
+
with tracing.span("step.load_data", input=dataset_name) as s:
|
|
124
306
|
data = load_data()
|
|
125
|
-
s.set_attribute(
|
|
307
|
+
s.set_attribute(tracing.semconv.OBSERVATION_OUTPUT, str(len(data)))
|
|
126
308
|
|
|
127
309
|
with tracing.span("step.process"):
|
|
128
310
|
process(data)
|
|
@@ -137,6 +319,9 @@ def span(
|
|
|
137
319
|
record_exception=record_exception,
|
|
138
320
|
set_status_on_exception=set_status_on_exception,
|
|
139
321
|
) as otel_span:
|
|
322
|
+
# Set input if provided
|
|
323
|
+
if input is not None:
|
|
324
|
+
otel_span.set_attribute(semconv.OBSERVATION_INPUT, _serialize_value(input))
|
|
140
325
|
try:
|
|
141
326
|
yield otel_span
|
|
142
327
|
except Exception:
|
|
@@ -147,6 +332,7 @@ def span(
|
|
|
147
332
|
def tool(
|
|
148
333
|
name: str,
|
|
149
334
|
*,
|
|
335
|
+
input: Optional[Any] = None,
|
|
150
336
|
tool_name: Optional[str] = None,
|
|
151
337
|
attributes: Optional[dict[str, Any]] = None,
|
|
152
338
|
record_exception: bool = True,
|
|
@@ -160,6 +346,7 @@ def tool(
|
|
|
160
346
|
|
|
161
347
|
Args:
|
|
162
348
|
name: The span name (often the function/tool name).
|
|
349
|
+
input: Input value to capture (displayed in Insight UI).
|
|
163
350
|
tool_name: Explicit tool name attribute (defaults to name).
|
|
164
351
|
attributes: Dictionary of attributes to set on the span.
|
|
165
352
|
record_exception: If True, exceptions are recorded on the span.
|
|
@@ -171,11 +358,11 @@ def tool(
|
|
|
171
358
|
|
|
172
359
|
Example::
|
|
173
360
|
|
|
174
|
-
import mantisdk.
|
|
361
|
+
import mantisdk.tracing as tracing
|
|
175
362
|
|
|
176
|
-
with tracing.tool("search_database", query
|
|
363
|
+
with tracing.tool("search_database", input=query) as s:
|
|
177
364
|
results = db.execute(query)
|
|
178
|
-
s.set_attribute(
|
|
365
|
+
s.set_attribute(tracing.semconv.OBSERVATION_OUTPUT, str(len(results)))
|
|
179
366
|
"""
|
|
180
367
|
tracer = _get_tracer()
|
|
181
368
|
all_attributes = {
|
|
@@ -192,6 +379,9 @@ def tool(
|
|
|
192
379
|
record_exception=record_exception,
|
|
193
380
|
set_status_on_exception=set_status_on_exception,
|
|
194
381
|
) as otel_span:
|
|
382
|
+
# Set input if provided
|
|
383
|
+
if input is not None:
|
|
384
|
+
otel_span.set_attribute(semconv.OBSERVATION_INPUT, _serialize_value(input))
|
|
195
385
|
try:
|
|
196
386
|
yield otel_span
|
|
197
387
|
except Exception:
|
|
@@ -202,6 +392,7 @@ def tool(
|
|
|
202
392
|
async def atrace(
|
|
203
393
|
name: str,
|
|
204
394
|
*,
|
|
395
|
+
input: Optional[Any] = None,
|
|
205
396
|
kind: SpanKind = SpanKind.INTERNAL,
|
|
206
397
|
attributes: Optional[dict[str, Any]] = None,
|
|
207
398
|
record_exception: bool = True,
|
|
@@ -214,6 +405,7 @@ async def atrace(
|
|
|
214
405
|
|
|
215
406
|
Args:
|
|
216
407
|
name: The name of the trace/span.
|
|
408
|
+
input: Input value to capture (displayed in Insight UI).
|
|
217
409
|
kind: The span kind (default: INTERNAL).
|
|
218
410
|
attributes: Dictionary of attributes to set on the span.
|
|
219
411
|
record_exception: If True, exceptions are recorded on the span.
|
|
@@ -225,10 +417,11 @@ async def atrace(
|
|
|
225
417
|
|
|
226
418
|
Example::
|
|
227
419
|
|
|
228
|
-
import mantisdk.
|
|
420
|
+
import mantisdk.tracing as tracing
|
|
229
421
|
|
|
230
|
-
async with tracing.atrace("my-async-workflow") as span:
|
|
422
|
+
async with tracing.atrace("my-async-workflow", input=query) as span:
|
|
231
423
|
result = await async_operation()
|
|
424
|
+
span.set_attribute(tracing.semconv.TRACE_OUTPUT, result)
|
|
232
425
|
"""
|
|
233
426
|
tracer = _get_tracer()
|
|
234
427
|
all_attributes = {**(attributes or {}), **extra_attributes}
|
|
@@ -240,6 +433,9 @@ async def atrace(
|
|
|
240
433
|
record_exception=record_exception,
|
|
241
434
|
set_status_on_exception=set_status_on_exception,
|
|
242
435
|
) as otel_span:
|
|
436
|
+
# Set input if provided
|
|
437
|
+
if input is not None:
|
|
438
|
+
otel_span.set_attribute(semconv.TRACE_INPUT, _serialize_value(input))
|
|
243
439
|
try:
|
|
244
440
|
yield otel_span
|
|
245
441
|
except Exception:
|
|
@@ -250,6 +446,7 @@ async def atrace(
|
|
|
250
446
|
async def aspan(
|
|
251
447
|
name: str,
|
|
252
448
|
*,
|
|
449
|
+
input: Optional[Any] = None,
|
|
253
450
|
kind: SpanKind = SpanKind.INTERNAL,
|
|
254
451
|
attributes: Optional[dict[str, Any]] = None,
|
|
255
452
|
record_exception: bool = True,
|
|
@@ -262,6 +459,7 @@ async def aspan(
|
|
|
262
459
|
|
|
263
460
|
Args:
|
|
264
461
|
name: The name of the span.
|
|
462
|
+
input: Input value to capture (displayed in Insight UI).
|
|
265
463
|
kind: The span kind (default: INTERNAL).
|
|
266
464
|
attributes: Dictionary of attributes to set on the span.
|
|
267
465
|
record_exception: If True, exceptions are recorded on the span.
|
|
@@ -273,12 +471,12 @@ async def aspan(
|
|
|
273
471
|
|
|
274
472
|
Example::
|
|
275
473
|
|
|
276
|
-
import mantisdk.
|
|
474
|
+
import mantisdk.tracing as tracing
|
|
277
475
|
|
|
278
|
-
async with tracing.atrace("workflow"):
|
|
476
|
+
async with tracing.atrace("workflow", input=query):
|
|
279
477
|
async with tracing.aspan("fetch_data") as s:
|
|
280
478
|
data = await fetch()
|
|
281
|
-
s.set_attribute(
|
|
479
|
+
s.set_attribute(tracing.semconv.OBSERVATION_OUTPUT, str(len(data)))
|
|
282
480
|
"""
|
|
283
481
|
tracer = _get_tracer()
|
|
284
482
|
all_attributes = {**(attributes or {}), **extra_attributes}
|
|
@@ -290,6 +488,9 @@ async def aspan(
|
|
|
290
488
|
record_exception=record_exception,
|
|
291
489
|
set_status_on_exception=set_status_on_exception,
|
|
292
490
|
) as otel_span:
|
|
491
|
+
# Set input if provided
|
|
492
|
+
if input is not None:
|
|
493
|
+
otel_span.set_attribute(semconv.OBSERVATION_INPUT, _serialize_value(input))
|
|
293
494
|
try:
|
|
294
495
|
yield otel_span
|
|
295
496
|
except Exception:
|
|
@@ -537,7 +738,7 @@ def get_current_span() -> Span:
|
|
|
537
738
|
span = tracing.get_current_span()
|
|
538
739
|
span.set_attribute("inner_data", "value")
|
|
539
740
|
"""
|
|
540
|
-
return
|
|
741
|
+
return otel_trace.get_current_span()
|
|
541
742
|
|
|
542
743
|
|
|
543
744
|
# Convenience aliases for decorator-style usage
|
|
@@ -35,8 +35,7 @@ def init(
|
|
|
35
35
|
*,
|
|
36
36
|
trace_name: Optional[str] = None,
|
|
37
37
|
service_name: Optional[str] = None,
|
|
38
|
-
instrument_default: bool =
|
|
39
|
-
instrument_agentops: bool = False,
|
|
38
|
+
instrument_default: bool = False,
|
|
40
39
|
exporters: Optional[List[SpanExporter]] = None,
|
|
41
40
|
trace_config: Optional["TraceConfig"] = None,
|
|
42
41
|
force: bool = False,
|
|
@@ -55,13 +54,11 @@ def init(
|
|
|
55
54
|
- If force=True, replaces the existing TracerProvider.
|
|
56
55
|
|
|
57
56
|
Args:
|
|
58
|
-
trace_name: Optional name for the trace
|
|
57
|
+
trace_name: Optional name for the trace.
|
|
59
58
|
service_name: Name of the service (mapped to resource attributes).
|
|
60
59
|
Defaults to "mantisdk-tracing".
|
|
61
60
|
instrument_default: Whether to automatically instrument the "core set"
|
|
62
61
|
of libraries (OpenAI, Anthropic, LangChain, LlamaIndex) if installed.
|
|
63
|
-
instrument_agentops: Whether to enable AgentOps helpers (decorators)
|
|
64
|
-
without exporting to AgentOps platform.
|
|
65
62
|
exporters: List of custom OpenTelemetry SpanExporters. If None and
|
|
66
63
|
Insight env vars are configured, auto-creates an Insight exporter.
|
|
67
64
|
trace_config: OpenInference TraceConfig for controlling capture behavior
|
|
@@ -69,7 +66,6 @@ def init(
|
|
|
69
66
|
force: If True, replaces any existing global TracerProvider. If False
|
|
70
67
|
(default), reuses the existing provider and appends processors.
|
|
71
68
|
integrations: Dictionary for fine-grained control over integrations.
|
|
72
|
-
Example: {"agentops": {"enabled": True, "helpers_only": True}}
|
|
73
69
|
|
|
74
70
|
Example::
|
|
75
71
|
|
|
@@ -143,9 +139,6 @@ def init(
|
|
|
143
139
|
if instrument_default:
|
|
144
140
|
instrument()
|
|
145
141
|
|
|
146
|
-
if instrument_agentops:
|
|
147
|
-
_setup_agentops_helpers(integrations)
|
|
148
|
-
|
|
149
142
|
_initialized = True
|
|
150
143
|
logger.info("MantisDK tracing initialized successfully")
|
|
151
144
|
|
|
@@ -336,26 +329,6 @@ def _get_exporter_id(exporter: SpanExporter) -> str:
|
|
|
336
329
|
return class_name
|
|
337
330
|
|
|
338
331
|
|
|
339
|
-
def _setup_agentops_helpers(integrations: Optional[Dict[str, Any]] = None) -> None:
|
|
340
|
-
"""Enable AgentOps helpers (decorators) without AgentOps export.
|
|
341
|
-
|
|
342
|
-
This sets up AgentOps instrumentation in "helpers only" mode,
|
|
343
|
-
where spans are created but exported through MantisDK's exporter
|
|
344
|
-
rather than AgentOps's backend.
|
|
345
|
-
"""
|
|
346
|
-
config = (integrations or {}).get("agentops", {})
|
|
347
|
-
if not config.get("enabled", True):
|
|
348
|
-
return
|
|
349
|
-
|
|
350
|
-
try:
|
|
351
|
-
import agentops
|
|
352
|
-
# AgentOps init with no API key = helpers only mode
|
|
353
|
-
# The spans will go through our TracerProvider
|
|
354
|
-
logger.debug("AgentOps helpers mode enabled")
|
|
355
|
-
except ImportError:
|
|
356
|
-
logger.debug("AgentOps not installed, skipping helpers setup")
|
|
357
|
-
|
|
358
|
-
|
|
359
332
|
def get_tracer(name: str = "mantisdk.tracing") -> trace.Tracer:
|
|
360
333
|
"""Get a tracer instance for creating spans.
|
|
361
334
|
|